package server;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;


import client.IClient;
import exception.NameTakenException;
import exception.UserNotConnectedException;
/**
 * Interface IServer that contains all features proposed by our server.
 * @author Thibault MERLE & Moritz FISCHER
 */
public interface IServer extends Remote {
	 public static final int RMI_REGISTRY_PORT = 2001;
	 
	 /**
	  * Function to log on the server. It's used by clients.
	  * @param client
	  * @param username
	  * @param password
	  * @throws RemoteException
	  * @throws NameTakenException
	  */
	 public void logOn(IClient client, String username) throws RemoteException, NameTakenException;
	 
	 /**
	  * Function that returns all the names of all connected clients.
	  * @return List<String>
	  * @throws RemoteException
	  */
	 public List<String> getClientNames() throws RemoteException;
	 
	 /**
	  * Function getClient that returns an interface of the client wanted
	  * in order to make operations on it (communicate with it).
	  * @param loginClient
	  * @return IClient
	  * @throws RemoteException
	  */
	 public IClient getClient(String loginClient) throws UserNotConnectedException,RemoteException;
	 
	 /**
	  * Function logOff used by a client to notify his left.
	  * @param leavingUser
	  * @throws RemoteException
	 * @throws UserNotConnectedException 
	  */
	 public void logOff(String leavingUser) throws RemoteException, UserNotConnectedException;
	 
	 /**
	  * Function used to send a message to everybody.
	  * @param sender
	  * @param message
	  * @throws RemoteException
	  */
	 public void sendMessage(String sender, String message) throws RemoteException;
	 
}
